package com.naiterui.ehp.bs.doctor.service;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.doctor.vo.ConsultCostVO;
import com.naiterui.ehp.bs.doctor.vo.DialogueDisplayVO;
import com.naiterui.ehp.bs.doctor.vo.SessionParamVO;

import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface IConsultSessionService {

    /**
     * IM聊天创建会话
     * IConsultSessionService.addNewSession()
     *
     * @param paramVO
     * @return
     * @throws BusinessException
     * @Date 2016年1月15日
     * @since 2.0.0
     */
    Map<String, Object> addNewSession(SessionParamVO paramVO) throws BusinessException;

    /**
     * IM医生主动结束咨询会话+超时自动结束会话
     * IConsultSessionService.updateSessionForClose()
     *
     * @param sessionId
     * @param endTime
     * @param freeFlag
     * @throws BusinessException
     * @Date 2016年1月15日
     * @since 2.0.0
     */
    Map<String, Object> updateSessionForClose(String sessionId, Long endTime,
                                              Integer freeFlag, Boolean isManual, Boolean isDeletePatient) throws BusinessException;


    /**
     * 更新会话推药标记
     * IConsultSessionService.updateSessionRecomFlag()
     *
     * @param consultSessionId
     * @Author guoyongxiang
     * @Date 2017年8月4日
     * @since 2.9.0
     */
    void updateSessionRecomFlag(Long consultSessionId);

    /**
     * 查询与医生有会话关系的患者关联就诊人信息
     *
     * @param patientId
     * @param doctorId
     * @return
     * @throws BusinessException
     */
    List<Long> findInqurirerByPatientIdAndDoctor(Long patientId, Long doctorId) throws BusinessException;

    /**
     * 根据sessionId查询会话关联就诊人
     *
     * @param sessionId
     * @return
     * @throws BusinessException
     */
    Long findInquirerBySessionId(String sessionId) throws BusinessException;


    /**
     * 获取会话关联就诊人
     *
     * @param id
     * @return
     * @throws BusinessException
     */
    Long findInquirerById(Long id) throws BusinessException;


    /**
     * 获取会话关联就诊人集合
     *
     * @param ids
     * @return
     * @throws BusinessException
     */
    Map<Long, Long> findInquirerByIds(Collection<Long> ids) throws BusinessException;

    /**
     * 获取咨询费用
     *
     * @param doctorId   医生id
     * @param patientId  患者id
     * @param inquirerId 就诊人id
     * @param chargeType 类型 1.图文 2.视频
     * @return 费用
     * @throws BusinessException
     */
    ConsultCostVO findConsultCostByDoctorIdAndPatientIdAndInquirerId(Long doctorId, Long patientId, Long inquirerId, Integer chargeType) throws BusinessException;

    /**
     * 对话显示的按钮
     * @param doctorId
     * @param patientId
     * @param inquirerId
     * @return
     */
    DialogueDisplayVO dialogueDisplay(Long doctorId, Long patientId, Long inquirerId);

    /**
     * 修改会话状态
     *
     * @param sessionId
     * @param sessionStatus
     */
    void updateSessionStatus(String sessionId, Integer sessionStatus) throws BusinessException;

    /**
     * 根据会话ID查询咨询表ID
     *
     * @param sessionId
     * @return
     */
    Long findIdBySessionId(String sessionId) throws BusinessException;
}
